﻿@{
    Layout = "_Layout_pop_scroll";
}
@section scripts{
    <script type="text/javascript">
        var UID = request('UID');
        var UName = request('UName');
        var bootstrap = function ($, ibpm) {
            "use strict";
            var page = {
                init: function () {
                    $('#UName').val(UName);
                    // 保存数据按钮(完成)
                    $("#Btn_Save").on('click', page.save);
                    page.bind();
                },
                bind: function () {
                    //绑定多选表格
                    $('#gridtable').jfGrid({
                        url: top.$.rootUrl + '/Org/Power/GetRoleListCheck?UID=' + UID,
                        headData: [
                            { label: "角色名称", name: "RoleName", width: 200, align: "left" },
                            { label: "角色编码", name: "RoleCode", width: 100, align: "center" },
                            { label: "角色类型", name: "RoleType", width: 100, align: "center" },
                        ],
                        mainId: 'RoleId',
                        isPage: false,
                        isMultiselect: true,
                        multiselectfield: 'Seq',
                        rows: 9900
                    }).jfGridSet('reload');
                },
                save: function () {
                    //提交保存--关闭层并刷新列表，交给“确认”按钮
                    var selectedRole = $('#gridtable').jfGridGet('rowdata');
                    var param = { EnId: UID };
                    param.ContentTxt = JSON.stringify(selectedRole);
                    ibpm.httpAsyncPost(top.$.rootUrl + "/Org/Power/RoleConfigSave", param, function (json) {
                        if (!!json.info)
                            ibpm.alert.success(json.info);

                        if (window.name != '') {
                            if (parent.layer && parent.layer.getFrameIndex(window.name)) {
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭
                                return;
                            }
                        }
                    });
                }
            };
            page.init();
        }
    </script>
}

<div class="row" style="margin: 5px;">
    <div class="form-group col-sm-2" style="text-align:right;">
        <label class="col-form-label">用户名称</label>
    </div>
    <div class="form-group col-sm-6">
        <input class="form-control single-line" id="UName" name="UName" readonly type="text" value="">
    </div>
    <div class="form-group col-sm-4">
        <div class="btn-group">
            <a id="Btn_Save" class="btn btn-success"><i class="fa fa-floppy-o"></i>&nbsp;保存配置</a>
        </div>
    </div>
</div>
<div class="row" style="margin: 5px;">
    <div class="step-pane">
        <div id="gridtable"></div>
    </div>
</div>